#include <iostream>
#include <string>
using namespace std;
int N;
string s;
void solve();

int main() {
    cin >> N >> s; 
    solve();
    return 0;
}

// ABBBA
void solve() {
    int f = 0, e = s.size() - 1;
    string t;
    while (f <= e) {
        int ft = f, et = e;
        while (ft < et && s[ft] == s[et]) ft++, et--;
        if (s[ft] < s[et]) t.push_back(s[f]), f++;
        else t.push_back(s[e]), e--;
    }
    cout << t << endl;
}